<!-- MRBR01（团体综合成绩公告） -->
<template>
  <div>
    <div class="item-info">
      <div
        :class="['single-item', item.flag ? 'active-item' : '']"
        v-for="(item, index) in singleItemList"
        :key="index"
      >
        <div>{{ item.name }}</div>
        <div class="item-logo">
          <img :src="item.logo" alt="" />
        </div>
      </div>
      <div class="single-item-info">
        <div class="info-line1">
          <div>{{ gameTitle }}</div>
          <div class="venue">{{ venueName }}</div>
        </div>
        <div class="info-line2">
          <div class="report-name">综合成绩公告</div>
          <div>{{ gameTime }}</div>
        </div>
      </div>
    </div>

    <div class="score-table-data" style="width: 100%;">
      <el-table
        :data="reportData"
        style="width: 100%"
        border
        stripe
        :header-cell-style="{ 'text-align': 'center' }"
        :cell-style="{ 'text-align': 'center' }"
      >
        <template v-for="(item, index) in tableHeader">
          <el-table-column :label="item.label" :prop="item.prop"></el-table-column>
        </template>
      </el-table>
    </div>
  </div>
</template>
<script>
import { mapState } from 'vuex'
export default {
  created() {
    this.venueName = this.$route.query.venueName
    this.gameTime = this.$route.query.gameTime
    this.gameTitle = this.$route.query.gameTitle
    this.filePath = this.$route.query.filePath
    this.getReportData()
  },
  props: {},
  data() {
    return {
      tableHeader: [
        { prop: 'Ranking', label: '名次' },
        { prop: 'Team', label: '单位' },
        { prop: 'VPS', label: 'VPs' },
        { prop: 'Penalty', label: '罚分' },
        { prop: 'Score', label: '累计' },
        { prop: 'Note', label: '备注' }
      ],
      tableData: [
        {
          Ranking: '1',
          Team: '123',
          VPS: '54.690%',
          Penalty: '55.745%',
          Score: '54.760%',
          Note: '48.810%'
        }
      ],
      filePath: '',
      venueName: '',
      gameTime: '',
      gameTitle: '',
      singleItemList: [
        {
          name: '桥牌',
          logo: require('@/assets/img/daily/BR.png'),
          flag: true
        }
      ]
    }
  },
  watch: {},
  computed: {
    ...mapState({
      reportData: state => state.schedule.reportData
    })
  },
  filters: {},
  components: {},
  methods: {
    getReportData() {
      this.$store
        .dispatch('getReportData', this.filePath + '.txt')
        .then(_ => {})
        .catch(error => {
          console.log(error)
        })
    }
  }
}
</script>
<style scoped lang="scss">
@import '@/assets/scss/item.scss';
</style>
